import request from '@/utils/request'
import { AxiosPromise } from 'axios'

enum Api {
  list = '/payment/list',
  changeStatus = '/payment/changeStatus',
  changeProperties = '/payment/changeProperties',
  detail = '/payment/detail',
}

// 获取列表
export const getPaymentList = (data): AxiosPromise<any> => {
  return request({
    url: Api.list,
    method: 'post',
    data,
  })
}

// 编辑、保存
export const changeProperties = (data: any) => {
  return request({
    url: Api.changeProperties,
    method: 'post',
    data,
  })
}

// 状态修改
export function changeStatus(id: string | number, status: number) {
  const data = {
    id,
    status,
  }
  return request({
    url: Api.changeStatus,
    method: 'post',
    data,
  })
}

// 获取设备详情
export const getPaymentDetail = (data) => {
  return request({
    url: Api.detail,
    method: 'post',
    data,
  })
}
